﻿
/*========================================================================================
// -- 
//创建者: goodasong
//创建时间：2011年8月22日 星期一
//类描述：实体类 TRights (属性说明自动提取数据库字段的描述信息)
//最后修改者:goodasong
//最后修改时间:2011年8月22日 星期一	
=========================================================================================*/
using System;
using System.Web;
using System.Runtime.Serialization;

namespace COM.Rights.Model
{
    /// <summary>
    /// 实体类 TRights (属性说明自动提取数据库字段的描述信息)
    /// </summary>
    [Serializable]	  
    [Model(Name = "TRights", PrimaryKey = "GID", ModelType = ModelType.Table, Condition = "1=1", IsNeedRecordModify = true)]
    public partial class TRightsInfo : BaseModel
    {
        public TRightsInfo()
        {            
            PrimaryKey = "GID"; 
			Fields.Add("ID");//ID
			Fields.Add("PID");//PID
			Fields.Add("GID");//GID
			Fields.Add("Name");//Name
			Fields.Add("Code");//Code
			
			
			CanNotNullFields.Add("ID");//ID不能为空!				
			
			CanNotNullFields.Add("PID");//PID不能为空!				
			
			CanNotNullFields.Add("GID");//GID不能为空!				
			
			CanNotNullFields.Add("Name");//Name不能为空!				
			this.OnCreated();			
			this.OnModelCreated();
        }
		public TRightsInfo(bool isNewInfo)
        {
			IsNew = isNewInfo;
		}
		#region 方法

        public void OnCreated() { this.SetPrimaryKeyValue(); }		

		public override void SetPrimaryKeyValue()
        {
            GID = Guid.NewGuid().ToString();
        }
        #endregion 
		
		#region 成员变量
				
		private int? _ID;//ID
		private int? _PID;//PID
		private string _GID;//GID
		private string _Name;//Name
		private string _Code;//Code
		
		#endregion
		
		#region 属性 
		
		/// <summary>
        /// ID
        /// </summary>       
		[ModelField(Description = "ID", Type = typeof(int?), ErrorMessage = "ID信息错误!", FieldType = FieldType.Normal, IsKeyField = false,IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 4,  DbType = "int", IsNeedRecordModify = true)]
        public virtual int? ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                if (_ID != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TRights", "ID", _ID, value, "int", "ID");   
                        this.OnPropertyChanging(modifyInfo);
                        this.OnIDChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._ID = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnIDChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);      
                    }
                    else
                    {
                        _ID = value;
                    }
                }
            }
        }
		
		/// <summary>
        /// PID
        /// </summary>       
		[ModelField(Description = "PID", Type = typeof(int?), ErrorMessage = "PID信息错误!", FieldType = FieldType.Normal, IsKeyField = false,IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 4,  DbType = "int", IsNeedRecordModify = true)]
        public virtual int? PID
        {
            get
            {
                return this._PID;
            }
            set
            {
                if (_PID != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TRights", "PID", _PID, value, "int", "PID");   
                        this.OnPropertyChanging(modifyInfo);
                        this.OnPIDChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._PID = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnPIDChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);      
                    }
                    else
                    {
                        _PID = value;
                    }
                }
            }
        }
		
		/// <summary>
        /// GID
        /// </summary>       
		[ModelField(Description = "GID", Type = typeof(string), ErrorMessage = "GID信息错误!", FieldType = FieldType.Normal, IsKeyField = true,IsUnique = true, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 36,  DbType = "char", IsNeedRecordModify = true)]
        public virtual string GID
        {
            get
            {
                return this._GID;
            }
            set
            {
                if (_GID != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TRights", "GID", _GID, value, "char", "GID");   
                        this.OnPropertyChanging(modifyInfo);
                        this.OnGIDChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._GID = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnGIDChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);      
                    }
                    else
                    {
                        _GID = value;
                    }
                }
            }
        }
		
		/// <summary>
        /// Name
        /// </summary>       
		[ModelField(Description = "Name", Type = typeof(string), ErrorMessage = "Name信息错误!", FieldType = FieldType.Normal, IsKeyField = false,IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 50,  DbType = "nvarchar", IsNeedRecordModify = true)]
        public virtual string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if (_Name != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TRights", "Name", _Name, value, "nvarchar", "Name");   
                        this.OnPropertyChanging(modifyInfo);
                        this.OnNameChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._Name = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnNameChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);      
                    }
                    else
                    {
                        _Name = value;
                    }
                }
            }
        }
		
		/// <summary>
        /// Code
        /// </summary>       
		[ModelField(Description = "Code", Type = typeof(string), ErrorMessage = "Code信息错误!", FieldType = FieldType.Normal, IsKeyField = false,IsUnique = false, IsForeignKey = false, IsAllowNull = true, IsDbGenerated = false, Size = 100,  DbType = "varchar", IsNeedRecordModify = true)]
        public virtual string Code
        {
            get
            {
                return this._Code;
            }
            set
            {
                if (_Code != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TRights", "Code", _Code, value, "varchar", "Code");   
                        this.OnPropertyChanging(modifyInfo);
                        this.OnCodeChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._Code = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnCodeChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);      
                    }
                    else
                    {
                        _Code = value;
                    }
                }
            }
        }
		#endregion 属性
				  
		#region 属性更改事件
		
		partial void OnIDChanging(ModifyInfo modifyInfo);//IDID改变之前发生
        partial void OnIDChanged(ModifyInfo modifyInfo);//IDID改变之后发生
		partial void OnPIDChanging(ModifyInfo modifyInfo);//PIDPID改变之前发生
        partial void OnPIDChanged(ModifyInfo modifyInfo);//PIDPID改变之后发生
		partial void OnGIDChanging(ModifyInfo modifyInfo);//GIDGID改变之前发生
        partial void OnGIDChanged(ModifyInfo modifyInfo);//GIDGID改变之后发生
		partial void OnNameChanging(ModifyInfo modifyInfo);//NameName改变之前发生
        partial void OnNameChanged(ModifyInfo modifyInfo);//NameName改变之后发生
		partial void OnCodeChanging(ModifyInfo modifyInfo);//CodeCode改变之前发生
        partial void OnCodeChanged(ModifyInfo modifyInfo);//CodeCode改变之后发生
		
		#endregion		
		
		public virtual string DetailURI { get; set; }
        public virtual string DetailHTMLURI { get; set; }
		public virtual string ManageEditURI {get; set;}
		public virtual string ManageDetailURI {get; set;}
		
		public override void OnLoaded()
        {
            base.OnLoaded();	
			DetailURI = ZModel.InitDetailURI("TRights", "GID", GID);
            DetailHTMLURI = ZModel.InitDetailHTMLURI("TRights", "GID", GID);		
			ManageEditURI = ZModel.InitMEditURI("TRights", "GID", GID);	
		 	ManageDetailURI = ZModel.InitMDetailURI("TRights", "GID", GID);	
			OnModelLoaded();
        }
		
		partial void OnModelCreated();
        partial void OnModelLoaded();
	}	
}